home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_toolbx.arc / GOPEN.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-30  |  1.1 KB  |  37 lines

  1. /* gopen.c - generalized file open and creat functions */
  2. /* Lattice C / Microsoft C version only */
  3. #include   "stdio.h"
  4. #include   "cminor.h"
  5. /* define File Mode bit for Binary Mode */
  6. #define BIN_BIT  0x8000
  7.  
  8. int gopen(fn,fmode,ft)                  /* generalized version of open */
  9.   char  fn[]  ;                         /* file name */
  10.   int   fmode ;                         /* file mode read/write */
  11.   int   ft ;                            /* file type ASCII/binary */
  12.   {
  13.      unsigned tmode ;
  14.  
  15.      tmode = fmode ;
  16.      if( ft == BIN_MODE )
  17.         tmode = tmode + (unsigned) BIN_BIT ;
  18.      return( open(fn,tmode) ) ;
  19.   }
  20.  
  21.  
  22. int  gcreat(fn,fmode,ft)                /* generalized version of creat */
  23.   char  fn[]  ;                         /* file name */
  24.   unsigned fmode ;                      /* file mode read/write */
  25.   int   ft ;                            /* file type ASCII/binary */
  26.   {
  27.      unsigned tmode ;
  28.  
  29.      tmode = fmode ;
  30.      if( ft == BIN_MODE )
  31.         tmode = tmode + (unsigned) BIN_BIT ;
  32.      return( creat(fn,tmode) ) ;
  33.   }
  34.  
  35. /* end of version */
  36.  
  37.